#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int main()
{
	int i, j, n, k, p, q, m;
	int a[10][10];
	scanf("%d", &n);
	m = 1;
	for (k = 1; k <= 2 * n - 1; k++)
	{
		if (k < n)
			q = k;
		else
			q = 2 * n - k;
		for (p = 1; p <= q; p++)
		{
			if (k % 2 != 0)
			{
				i = q - p + 1;
				j = p;
			}
			else
			{
				i = p;
				j = q - p + 1;
			}
			if (k >= n)
			{
				i = i + n - q;
				j = j + n - q;
			}
			a[i][j] = m;
			m++;
		}
		for (i = 1; i <= n; i++)
		{
			for (j = 1; j <= n; j++)
			{
				printf("%4d", a[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}